/* 
 * File:   LineOperator.cpp
 * Author: itu
 * 
 * Created on November 26, 2011, 5:21 PM
 */

#include "LineOperator.h"

LineOperator::LineOperator(){

}

LineOperator::LineOperator(string aLine) {
    line = aLine;
    iss << line;
}

string LineOperator::getStringBefore(string limiter){
    string parsedString,theString;
    while(iss>>parsedString){
        if(parsedString!=limiter)
            theString.append(parsedString);
        else break;
    }
    return theString;
}

bool LineOperator::hasNextString(){
    lastParsed="";
    if(iss>>lastParsed)
        return true;
    return false;
}

void LineOperator::setLine(string newLine){
    line = newLine;
    iss << line;
}

bool LineOperator::isGoodForStreaming(){
    if(iss.good())
        return true;
    return false;
}

string LineOperator::getString(){
    return lastParsed;
}

string LineOperator::getLine(){
    return line;
}

void LineOperator::setLastParsed(string next){
    lastParsed = next;
}